<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>后台登录-X-admin1.1</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="__PUBLIC__/admin/css/font.css">
    <link rel="stylesheet" href="__PUBLIC__/admin/css/xadmin.css">
    <link rel="stylesheet" href="https://cdn.bootcss.com/Swiper/3.4.2/css/swiper.min.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="https://cdn.bootcss.com/Swiper/3.4.2/js/swiper.jquery.min.js"></script>
    <script src="__PUBLIC__/admin/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="__PUBLIC__/admin/js/xadmin.js"></script>

</head>
<body>
    <!-- 中部开始 -->
    <div class="wrapper">
        <!-- 右侧主体开始 -->
        <div class="page-content">
          <div class="content">
            <!-- 右侧内容框架，更改从这里开始 -->
            <form class="layui-form">
                <div class="layui-form-item">
                    <label for="L_city" class="layui-form-label">项目名称</label>
                    <div class="layui-input-inline">
                        <input type="text" autocomplete="off" name="xm_name" value="{$xm_info.xm_name}" class="layui-input">
                    </div>
                    <span style="padding-top: 10px;font-size: 8px;color: red;">郑重提示：项目名称不要经常修改</span>
                </div>
                <div class="layui-form-item">
                    <label for="L_city" class="layui-form-label">项目天数</label>
                    <div class="layui-input-inline">
                        <input type="text" autocomplete="off" name="xm_days" value="{$xm_info.xm_days}" class="layui-input">
                    </div>
                    <span style="padding-top: 10px;font-size: 8px;color: red;">项目距离结束的天数</span>
                </div>

                <div class="layui-form-item">
                    <label for="L_username" class="layui-form-label">项目ID</label>
                    <div class="layui-input-inline">
                        <input type="text" autocomplete="off" value="{$xm_info.id}" class="layui-input" disabled style="color: #999;">
                    </div>
                    <label for="L_username" class="layui-form-label">用户名</label>
                    <div class="layui-input-inline">
                        <input type="text" autocomplete="off" value="<?php echo reuid_name($xm_info['uid']) ?>" class="layui-input" disabled style="color: #999;">
                    </div>
                    <span style="padding-top: 10px;font-size: 8px;color: red;">项目ID、用户不能修改</span>
                </div>
                <div class="layui-form-item">
                    <label for="L_city" class="layui-form-label">项目类型</label>
                    <div class="layui-input-inline">
                        <input type="text" autocomplete="off" name="xm_type" value="{$xm_info.xm_type}" class="layui-input">
                    </div>
                    <label for="L_city" class="layui-form-label">项目地域</label>
                    <div class="layui-input-inline">
                        <input type="text" autocomplete="off" name="xm_diyu" value="{$xm_info.xm_diyu}" class="layui-input">
                    </div>
                    <span style="padding-top: 10px;font-size: 8px;color: red;">项目捐赠的地域例如：广东贫困山区</span>
                </div>
                <div class="layui-form-item">
                    <label for="L_city" class="layui-form-label">项目目标</label>
                    <div class="layui-input-inline">
                        <input type="text" autocomplete="off" name="xm_mubiao" value="{$xm_info.xm_mubiao}" class="layui-input">
                    </div>
                    <label for="L_city" class="layui-form-label">捐赠数量</label>
                    <div class="layui-input-inline">
                        <input type="text" autocomplete="off"  value="{$xm_info.xm_num}" class="layui-input" disabled style="color: #999;">
                    </div>
                    <span style="padding-top: 10px;font-size: 8px;color: red;">捐赠数量系统自动计算生成</span>
                </div>

                <div class="layui-form-item">
                    <label for="L_city" class="layui-form-label">接收组织</label>
                    <div class="layui-input-inline">
                        <input type="text" autocomplete="off" name="organ" value="{$xm_info.organ}" class="layui-input">
                    </div>
                    <span style="padding-top: 10px;font-size: 8px;color: red;">接收捐物的组织例如：顺丰</span>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label for="L_sign" class="layui-form-label">项目摘要</label>
                    <div class="layui-input-inline">
                        <textarea placeholder="输入项目摘要" name="xm_content" autocomplete="off" class="layui-textarea" style="min-height: 0px;width: 350px;">{$xm_info.xm_content}</textarea>
                    </div>
                    <span style="padding-top: 10px;font-size: 8px;color: red;">郑重提示：项目摘要不要超过100字</span>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label for="L_sign" class="layui-form-label">项目详情</label>
                    <div class="layui-input-inline">
                        <textarea placeholder="输入项目详细情况" name="xm_xiangq" autocomplete="off" class="layui-textarea" style="min-height: 80px;width: 350px;">{$xm_info.xm_xiangq}</textarea>
                    </div>
                    <span style="padding-top: 10px;font-size: 8px;color: red;">郑重提示：项目详情不要超过200字</span>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label for="L_sign" class="layui-form-label">筹集清单</label>
                    <div class="layui-input-inline">
                        <textarea placeholder="输入项目清单筹集内容" name="xm_list" autocomplete="off" class="layui-textarea" style="min-height: 80px;width: 350px;">{$xm_info.xm_list}</textarea>
                    </div>
                    <span style="padding-top: 10px;font-size: 8px;color: red;">郑重提示：筹集清单不要超过200字</span>
                </div>
                <div class="layui-form-item">
                    <label for="L_sign" class="layui-form-label"></label>
                    <input type="hidden" name="id" value="{$xm_info.id}">
                    <button class="layui-btn" key="set-mine" lay-filter="save" lay-submit>修改</button>
                </div>
            </form>
            <!-- 右侧内容框架，更改从这里结束 -->
          </div>
        </div>
        <!-- 右侧主体结束 -->
    </div>
    <!-- 中部结束 -->
        <script>
            layui.use(['form','layer'], function(){
                $ = layui.jquery;
              var form = layui.form()
              ,layer = layui.layer;

              //监听提交
              form.on('submit(save)', function(data){
                //console.log(data);
                //发异步，把数据提交给php
                $.ajax({
                    url: "{:U('admin/xm/edit')}",//请求地址
                    type: "post",//请求方式
                    dataType: "json",//返回数据类型
                    data: data.field,//发送的参数
                    })
                    .done(function(response) {
                          if(response.error==0){
                             layer.msg(response.info ,{icon:5});

                          }else{
                            layer.alert(response.info, {icon: 6},function () {
                                // 获得frame索引
                                var index = parent.layer.getFrameIndex(window.name);
                                //关闭当前frame
                                parent.layer.close(index);
                                parent.location.reload();
                            });
                          }
                      })
                    .fail(function() {
                        alert("ajxs交互失败");
                    })  

                return false;
              });
              
            });
        </script>
</body>
</html>